﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace atm
{
    class Model
    {
        bool user;
        int balance;
        public bool login(string cardNum, string PIN)
        {
            if (cardNum == "0123456" && PIN == "456")
            {
                Console.WriteLine("Login success");
                user = true;
                balance = 1000;
                return true;
            }
            return false;
        }

        public void logout()
        {
            Console.WriteLine("Logout success");
            user = false;
            balance = 0;
        }

        public int getBalance()
        {
            return balance;
        }

        public bool takeCash(int amount)
        {
            
            user=true;
            if (user==true && getBalance()>amount)
            {
                Console.WriteLine("You have enough money!");
                balance = balance - amount;
                return true;
            }
            return false;
        }

     
    }
}
